package com.test.nnooolwdeaer.activity_fragment_wooden.base_wooden;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.test.nnooolwdeaer.bean_wooden.user_info_wooden.LoginInfo_wooden;
import com.test.nnooolwdeaer.constant_wooden.Constant_wooden;
import com.test.nnooolwdeaer.util_wooden.helper_wooden.UserInfoHelper_wooden;
import com.test.nnooolwdeaer.util_wooden.http_wooden.HttpManager_wooden;
import com.test.nnooolwdeaer.util_wooden.analytics_wooden.event_wooden.IAnalyticsEvent_wooden;
import com.test.nnooolwdeaer.util_wooden.analytics_wooden.util_wooden.AnalyticsUtil_wooden;

import org.json.JSONObject;


public abstract class BaseLoginActivity_wooden extends BaseActivity_wooden {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public abstract void onRequestOtpCodeResponse_wooden(JSONObject jsonObject);

    //登录成功响应
    public void onUserLoginResponse_wooden() {
        try {
            //String phoneNum = UserInfoHelper.getInstance().getMobile();
            //打点
            String gtype = LoginInfo_wooden.getInstance_wooden().getType_wooden();
            if (gtype.equalsIgnoreCase(UserInfoHelper_wooden.LOGIN_TYPE_REGISTER_wooden)) {
//                AFInstallHelper.getInstance().saveEventInfo(AFInstallHelper.AFEvent.AT_REGISTER);
//                FirebaseHelper.getInstance().saveEventInfo(AFInstallHelper.AFEvent.AT_REGISTER);
                AnalyticsUtil_wooden.INSTANCE.addEvent(IAnalyticsEvent_wooden.AT_REGISTER);
            }
            //保存登录信息到本地
            UserInfoHelper_wooden.getInstance_wooden().setToken_wooden(LoginInfo_wooden.getInstance_wooden().getToken_wooden());
            UserInfoHelper_wooden.getInstance_wooden().setUserId_wooden(LoginInfo_wooden.getInstance_wooden().getUserId_wooden());
            //UserInfoHelper.getInstance().setMobile(phoneNum);

            //保存firebase s2s
            //HttpManager.getInstance().saveFirebaseS2SInfo();

            //登录前初始化
            AnalyticsUtil_wooden.INSTANCE.initDevice(BaseApplication_wooden.getApplication());
            AnalyticsUtil_wooden.INSTANCE.saveFirebaseS2SInfo();

            //请求用户流程信息
            HttpManager_wooden.getInstance_wooden().requestUserProcess_wooden();
        } catch (Exception e) {
            if (Constant_wooden.Debug) e.printStackTrace();
        }
    }

}